﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Web;

/// <summary>
/// TrustAllCertificatePolicy用來驗證SSL
/// 在WS叫用前使用以下程式碼，就可通過SSL
/// System.Net.ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy(); 
/// 參考資源：http://support.microsoft.com/kb/901183
/// http://60-251-1-52.hinet-ip.hinet.net/taiwan/msdn/books/ataglance/SecNetHT14.htm
/// </summary>
public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
{

  public TrustAllCertificatePolicy()
  { }

  public bool CheckValidationResult(ServicePoint sp,
    System.Security.Cryptography.X509Certificates.X509Certificate cert,
    WebRequest req, int problem)
  {
    return true;
  }
}


